package net.monkeybros.sbus.model;

import com.neurospeech.wsclient.*;
import org.w3c.dom.*;

public class InfoNodoMap extends WSObject
{
	
	private Integer _nodo;
	public Integer getnodo(){
		return _nodo;
	}
	public void setnodo(Integer value){
		_nodo = value;
	}
	private Integer _tipo;
	public Integer gettipo(){
		return _tipo;
	}
	public void settipo(Integer value){
		_tipo = value;
	}
	private String _nombre;
	public String getnombre(){
		return _nombre;
	}
	public void setnombre(String value){
		_nombre = value;
	}
	private String _label;
	public String getlabel(){
		return _label;
	}
	public void setlabel(String value){
		_label = value;
	}
	private Boolean _visible;
	public Boolean getvisible(){
		return _visible;
	}
	public void setvisible(Boolean value){
		_visible = value;
	}
	private Double _posx;
	public Double getposx(){
		return _posx;
	}
	public void setposx(Double value){
		_posx = value;
	}
	private Double _posy;
	public Double getposy(){
		return _posy;
	}
	public void setposy(Double value){
		_posy = value;
	}
	
	public static InfoNodoMap loadFrom(Element root) throws Exception
	{
		if(root==null){
			return null;
		}
		InfoNodoMap result = new InfoNodoMap();
		result.load(root);
		return result;
	}
	
	
	protected void load(Element root) throws Exception
	{
		this.setnodo(WSHelper.getInteger(root,"nodo",false));
		this.settipo(WSHelper.getInteger(root,"tipo",false));
		this.setnombre(WSHelper.getString(root,"nombre",false));
		this.setlabel(WSHelper.getString(root,"label",false));
		this.setvisible(WSHelper.getBoolean(root,"visible",false));
		this.setposx(WSHelper.getDouble(root,"posx",false));
		this.setposy(WSHelper.getDouble(root,"posy",false));
	}
	
	
	
	public Element toXMLElement(Element root)
	{
		Element e = root.getOwnerDocument().createElement("InfoNodoMap");
		fillXML(e);
		return e;
	}
	
	public void fillXML(Element e)
	{
		WSHelper.addChild(e,"nodo",String.valueOf(_nodo),false);
		WSHelper.addChild(e,"tipo",String.valueOf(_tipo),false);
		if(_nombre!=null)
			WSHelper.addChild(e,"nombre",String.valueOf(_nombre),false);
		if(_label!=null)
			WSHelper.addChild(e,"label",String.valueOf(_label),false);
		WSHelper.addChild(e,"visible",(_visible ? "true" : "false"),false);
		WSHelper.addChild(e,"posx",String.valueOf(_posx),false);
		WSHelper.addChild(e,"posy",String.valueOf(_posy),false);
	}
	
}
